/**
 * 
 */
package com.feib.stms.dao.jdbc.rowmapper;

import java.sql.ResultSet;

import org.springframework.jdbc.core.RowMapper;

import com.feib.stms.model.Group;
import com.feib.stms.model.User;
import com.feib.stms.model.UserLoginHistory;

/**
 * @author Jimmy Liu
 *
 */
public class UserLoginHistoryRowMapper extends BaseRowMapper<UserLoginHistory> implements RowMapper<UserLoginHistory> 
{
	private static final long serialVersionUID = 4395989942171823138L;

	public UserLoginHistoryRowMapper() 
	{
		super(UserLoginHistory.class);
	}

	@Override
	protected UserLoginHistory doOtherMapRow(ResultSet rs, int rowNumber, UserLoginHistory entity) 
	{
		entity.setUser(new User());
		entity.getUser().setGroup(new Group());
		entity.getUser().setUserPk((Long)getColumnValue(rs, "USER_PK", Long.class));
		entity.getUser().setUserId((String)getColumnValue(rs, "USER_ID", String.class));
		entity.getUser().getGroup().setGroupNo((String)getColumnValue(rs, "GROUP_NO", String.class));
		
		return entity;
	}
}
